home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / escalant / escala21.lha / escalante2.1 / bin / GenericEd.h < prev    next >
C/C++ Source or Header  |  1993-07-14  |  7KB  |  341 lines

  1. #ifndef <PNAME>_First
  2. #define <PNAME>_First
  3.  
  4.  
  5. //
  6. //This file contains the classes that make up the language specific 
  7. //editor component. The <PNAME>View class contains most of the potential
  8. //functionality. Many  of the methods are commented out. They are there to show
  9. //you what  can be done. Some of these methods are described here in the .h, 
  10. //the others are described in the .C
  11. //
  12.  
  13.  
  14.  
  15.  
  16. #include "EscalanteView.h"
  17. #include "Escalante.h"
  18.  
  19.  
  20.  
  21. #include "Fields.h"
  22. #include "TextItem.h"
  23.  
  24.  
  25.  
  26.  
  27. //
  28. //You can make your own timer object. This object gets called backed
  29. //and calls the method Tick(). We have a list of elements alreaady defined here
  30. //if needed.
  31. //
  32. #include "TimerObject.h"
  33.  
  34. class <PNAME>Timer: public TimerObject{
  35. public:
  36. ObjList * elements;
  37. <PNAME>Timer(bool active = TRUE, int rate = 1):TimerObject(active,rate){
  38. elements = new ObjList();
  39. }
  40. void Add(Object*e) {
  41.     if(!elements->ContainsPtr(e))
  42.         elements->Add(e);
  43. }
  44.  
  45. void Remove(Object*e) {elements->Remove(e);}
  46. void Tick();
  47. };
  48.  
  49.  
  50.  
  51.  
  52.  
  53. enum <PNAME>MenuIds{
  54.     e<PNAME>MENU     = cESCALANTELASTMENUID+1,
  55.     e<PNAME>HideMenu,
  56.     ePullRightMenu
  57. };
  58.  
  59. enum <PNAME>Actions{
  60.     <PNAME>Action1  =ESCALANTEVIEWLASTACTION+1,
  61.     <PNAME>Action2,
  62.     <PNAME>Action3,
  63.     <PNAME>HideLabels,
  64.     <PNAME>StepTimer,
  65.     <PNAME>ToggleTimer,
  66. #include "<PNAME>HSEnum.h"
  67.     //Here is an action include
  68. #include "<PNAME>ActionEnum.h"
  69. };
  70.  
  71. class Document;
  72. class VObject;
  73.  
  74.  
  75. enum <PNAME>ViewFlags{e<PNAME>ViewLast = eEscalanteViewLast};
  76.                 
  77. #define <PNAME>View_BASE  EscalanteView
  78.  
  79. class <PNAME>View: public <PNAME>View_BASE {
  80. public:
  81. MetaDef(<PNAME>View);
  82. <PNAME>View(int id,
  83.         Document*  doc,
  84.         Point pt,
  85.         VGraphElement* vg,
  86.         bool makePalette = TRUE);
  87.  
  88.  
  89.  
  90.  
  91.  
  92. bool        SetAction2(Actions m,void*  data =0);
  93. Command*     DoLeftButtonDownCommand(Point p, Token t, int i);
  94. Command*     DoMiddleButtonDownCommand(Point p, Token t, int i);
  95. static Menu*      MakeMenu(int );
  96. void         DoSetupMenu(class Menu* );
  97.  
  98.  
  99. //
  100. //Misc. methods one can use. Any method not described here will probably be
  101. //described in the .C
  102. //
  103.  
  104.  
  105. //
  106. //bool        NewHeadOk(VRelation*  nr,VGraphElement* e);
  107. //bool        NewTailOk(VRelation*  nr,VGraphElement* e);
  108. //
  109.  
  110.  
  111.  
  112.  
  113.  
  114. //
  115. //There is a facility to read/write raw text files.  
  116. //Using the actions: WRITE_TEXT_TO_FILE, READ_TEXT_FROM_FILE.
  117. //The following methods are called to get the text associated with the picked
  118. //element and to do somwthing with the text from a reading. 
  119. //
  120. //char *  GetTextToWrite(VGraphElement*){return 0;}
  121. //void HereIsSomeText(char *,VGraphElement*){}
  122.  
  123.  
  124. //You can associate a ObjectGrid with a view. The default id to get the
  125. //grid from the vgraph->GetGrid() method;
  126. ObjectGrid*     GetGrid();
  127.  
  128.  
  129. //This method  is called when this object is an observer of some other object
  130. //void        DoObserve(int id, int part, void *d , Object *op);
  131. //
  132.  
  133. //
  134. //When a key is pressed this method is called
  135. //Command     *DoKeyCommand(int key, Token t){
  136. //    return <PNAME>_BASE::DoKeyCommand(key,t);
  137. //}
  138. //
  139.  
  140.  
  141. //
  142. //char*      ActionName(Actions action);
  143. //    
  144.  
  145. //
  146. //void         Control(int id, int part, void* val);
  147. //
  148.  
  149. //void         AddToToolList(ObjList* l);
  150.  
  151. //void         SignalError(char*  c);
  152. //void         ClearError();
  153.  
  154. //void         SignalMode(char*  c);
  155. //void         ClearMode();
  156.  
  157.  
  158. //
  159. //When adding an element using elt as a prototype do we use the multiple
  160. //add command object? This type of add keeps adding objects as long as
  161. //the button is down.
  162. //bool AddMultiples(VGraphElement *elt){return TRUE;}
  163. //
  164.  
  165.  
  166. //
  167. //void         DoneDrawingRect();
  168. //
  169.  
  170. //
  171. //ErrorReturn    CouldNotFindHead(VRelation*,Set * s=0 );
  172. //ErrorReturn    CouldNotFindTail(VRelation*, Set* s = 0 );
  173. //    
  174.  
  175. //
  176. //bool         OkToDeleteElement(VGraphElement* );
  177. //void        DoneAddingElements(class Set*);
  178. //void         DoneAddingElement(VGraphElement* );
  179. //void        DoneMovingElement(VGraphElement*);
  180. //
  181.  
  182.  
  183. //
  184. //void         Draw(Rectangle);
  185. //void         DrawGraph(Rectangle r);
  186. //
  187.  
  188.  
  189. //
  190. //Misc. methods concerning the  palette
  191. //
  192.  
  193.  
  194.  
  195. //
  196. //How big are the palette items
  197. //
  198. //    Point GetPaletteItemSize(){return Point(16,16);}
  199. //
  200. //Overrides the ETRC MakeSeparatePalette when it (the ETRC flag ) is FALSE
  201. //
  202. //bool MakeSeparatePalette(){return TRUE;}
  203. //
  204. //Overrides the ETRC MakeExtraPalette when it (the ETRC flag ) is TRUE
  205. //
  206. //bool DoNotMakeExtraPalette(){return TRUE;}
  207. //
  208. //Overrides the ETRC MakePalette when it (the ETRC flag ) is set to false
  209. //
  210. //bool ForceMakePalette(){return TRUE;}
  211. //
  212.  
  213.  
  214.  
  215.  
  216. //
  217. //Overrides the ETRC MakeObserverView when it (the ETRC flag ) is TRUE
  218. //
  219. //    bool DoNotMakeObserverView(){return TRUE;}
  220. //
  221.  
  222.  
  223.  
  224. //
  225. //These methods can be used to  define how the palette is set up for this view. 
  226. //
  227. //GetOrientation: Where does the palette go?   0->Left,1->Top,2->Right,3->Bottom
  228. //
  229. //int        GetOrientation(){return 0;}
  230. //
  231. //How many rows/columns are there in the palette
  232. //
  233. //int        GetRows(){return 0;}
  234. //int        GetCols(){return 1;}
  235. //
  236.  
  237.  
  238. //
  239. //This method  can be used to return a list of the prototype objects
  240. //that are placed in the palette. The list is assumed to be made of
  241. //of VGraphElement*. The default behavior is to return the protos list 
  242. //contained in the   vgraph.
  243. //The virtual method EscalanteView:: MakeToolList() is called when    we need to make 
  244. //a new palette. If you wanted to change the palette then make the change to your list
  245. //and call MakeToolList. This will update your palette.
  246. //
  247. //ObjList*      GetProtoList(){}
  248. //
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255. //
  256. //These methods are all described in the .C
  257. //
  258.  
  259. //
  260. //void         GetNewGraph(VGraphElement *  vg,VGraphElement * & newvg);
  261. //
  262.  
  263. //
  264. //void        NewGraph(VGraphElement *, bool push = FALSE);
  265. //
  266.  
  267.  
  268.  
  269. //
  270. //VObject*    GetView();
  271. //
  272.  
  273. //VObject*    GetTopVObj();
  274. //VObject*    GetBottomVObj();
  275.  
  276.  
  277.  
  278.  
  279.  
  280. //
  281. //char*        GetDescription();
  282. //char*        GetElementDescription(VGraphElement* );
  283. //char*        GetActionDescription(Actions);
  284. //
  285.  
  286. };
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293. #define <PNAME>Document_BASE EscalanteDocument
  294. class <PNAME>Document : public <PNAME>Document_BASE {
  295. public:
  296. MetaDef(<PNAME>Document);
  297. <PNAME>Document(VGraphElement*  vg):<PNAME>Document_BASE(vg) {
  298.           Manager::SetName("<PNAME> View");
  299.           }
  300.  
  301. EscalanteView*    MakeEscalanteView(int,Point,VGraphElement* );
  302. MenuBar*    DoMakeMenuBar();
  303. void        DoSetupMenu(Menu* );
  304.  
  305. //
  306. //void        Control(int id, int part, void* val);
  307. //
  308.  
  309. };
  310.  
  311.  
  312.  
  313. #define <PNAME>Manager_BASE EscalanteManager
  314. class <PNAME>Manager : public <PNAME>Manager_BASE {
  315. public:
  316. MetaDef(<PNAME>Manager);
  317. <PNAME>Manager(SGraphElement*  sg,
  318.            class ObjList*  vg,
  319.            char*  docType =cDocTypeSgVgs ):<PNAME>Manager_BASE(sg,vg,docType){}
  320.  
  321. EscalanteDocument*    MakeEscalanteDocument(VGraphElement* );
  322. };
  323.  
  324.  
  325.  
  326. #define <PNAME>_BASE Escalante
  327. class <PNAME>: public <PNAME>_BASE { 
  328. public:
  329. MetaDef(<PNAME>);
  330. <PNAME>(int argc, char* * argv);
  331.  
  332. void        MakeGraph(SGraphElement* & ,ObjList*  &);
  333. EscalanteManager*    MakeEscalanteManager(SGraphElement*  sg,ObjList*  vgs);
  334. };
  335.  
  336.  
  337. #endif 
  338.  
  339.  
  340.  
  341.